from sqlmodel import Field, Session, SQLModel, create_engine

# create table of category names and number of images:
# 
#  |  id  |   name   |  images |
#  +------+----------+---------+
#  |   1  |  tesla   |    19   |
#  +------+----------+---------+
#  |   2  |  trump   |    55   |
#  +------+----------+---------+
 

class Cat(SQLModel, table=True):
    id: int | None = Field(default=None, primary_key=True)
    name: str
    images: int | None = None


cat1 = Cat(name='cabinet', images=20)
cat2 = Cat(name='canada', images=42)
cat3 = Cat(name="corruption", images=8)
cat4 = Cat(name="crypto", images=7)
cat5 = Cat(name='elon', images=24)
cat6 = Cat(name='maga', images=28)
cat7 = Cat(name='mtg', images=17)
cat8 = Cat(name="pope", images=7)
cat9 = Cat(name='protest', images=36)
cat10 = Cat(name="scotus", images=5)
cat11 = Cat(name='tariffs', images=21)
cat12 = Cat(name='tesla', images=19)
cat13 = Cat(name='trump', images=57) 
cat14 = Cat(name='ukraine', images=25)
cat15 = Cat(name="vance", images=5)


engine = create_engine("sqlite:///memes.db")

SQLModel.metadata.create_all(engine)

with Session(engine) as session:
    session.add(cat1)
    session.add(cat2)
    session.add(cat3)
    session.add(cat4)
    session.add(cat5)
    session.add(cat6)
    session.add(cat7)
    session.add(cat8)
    session.add(cat9)
    session.add(cat10)
    session.add(cat11)
    session.add(cat12)
    session.commit()
